Skip to content

chore: inspect for mutations in serialization methods#2327

Merged
MaggieKimani1 merged 2 commits into
mainfrom
fix/test-for-mutations-during-serialization
Apr 16, 2025
Merged

chore: inspect for mutations in serialization methods#2327
MaggieKimani1 merged 2 commits into
mainfrom
fix/test-for-mutations-during-serialization

Conversation

@MaggieKimani1

@MaggieKimani1 MaggieKimani1 commented Apr 15, 2025

Copy link
Copy Markdown
Contributor

Adds a unit test to inspect whether we mutate any public properties in the DOM by:

  • Adding a complete OpenApi document - with 3.1 features and loading it into a DOM
  • Serializing the DOM using a standard serializer - System.Text.JSON
  • Serializing the same DOM using our current serialization infrastructure
  • Serializing the DOM again using STJ
  • Doing a deep comparison for the two STJ-serialized versions. If they're different, our custom serialization likely mutated the public DOM.

Fixes #2080

@baywet baywet left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great start! a couple of comments to help finalize this.

@MaggieKimani1
MaggieKimani1 marked this pull request as ready for review April 16, 2025 13:07
@MaggieKimani1
MaggieKimani1 requested a review from a team as a code owner April 16, 2025 13:07
@MaggieKimani1
MaggieKimani1 enabled auto-merge April 16, 2025 13:08
@sonarqubecloud

Copy link
Copy Markdown

@baywet baywet left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work!

@MaggieKimani1
MaggieKimani1 merged commit bb9f706 into main Apr 16, 2025
@MaggieKimani1
MaggieKimani1 deleted the fix/test-for-mutations-during-serialization branch April 16, 2025 16:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

v2 - inspect for mutations in serialization methods

2 participants